<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script src="/xlive/script/xlv.js"></script>
</head>
<body>
	<div id="queryTopic_main" xlvobject="xlv.obj.borderLayout"
		xlvmethod="{
			styleFor:function(layout){
				var style={width:'100%',background:'url(/xlive/images/grayTexture.gif) left top repeat'};
				style.borderLeft='1px solid gray';
				style.borderTop='1px solid gray';
				style.borderRight='1px solid white';
				style.borderBottom='1px solid white';
				style.minHeight='480px';
				style.fontFamily='Arial';
				style.fontSize='12px';
				Element.setStyle(layout,style);
			}
		}"
	>
		<style type="text/css">
			#next_flip,#prev_flip,
			#page_control #page{
				background: url(/xlive/images/background_silver.jpg) repeat-x;
				border: 1px solid gray;
				cursor: default;
				padding: 2px 3px;
				margin: 2px 1px;
				color: gray;
				float: left;
			}
			#next_flip:hover,#prev_flip:hover,
			#page_control #page:hover{
				margin-top:0px;
				color:blue;
			}
			#page_control #page.current_page:hover,
			#page_control #page.current_page{
				margin-top:0px;
				color:blue;
				font-weight:bold;
			}
			#page_control.wait *{
				cursor:wait;
			}
		</style>
		<div xlvobject="xlv.obj.rowset" 
			 xlvprop="{name:'forum.topic',objectURL:'forum.topic',dataXPath:'properties.query-list.return.sql-statement.return.data',methodName:'query-list'}"
			 xlvmethod="{
			 	initial:function(){
			 		var queryTopic_main=xlv.util.findParent(this,{id:'queryTopic_main'});
			 		var forum_key=queryTopic_main.$P.caller.forum_key;
			 		var query_text='%'+queryTopic_main.$P.caller.query_text+'%';
			 		this.$P.webObjectProperties={'query-list':{'forum-key':forum_key,'query-text':query_text}};
			 		this.$self('initial');
			 	}
			 }"
			 >
		</div>
		<div id="xlvid_north">
			<nobr>
			<img src='/xlive/images/forum/forward.png' width="18"></img>
			<span xlvobject="xlv.obj.process" xlvprop="{title:' calalog'}"
				 xlvmethod="{
				 	process:function(options){
    					this.getBorderLayoutById('forum_main').setCenterPane('/xlive/forum/catalog.html',null,null,'bottom');
					}
				 }"
				>
			</span>
			<img src='/xlive/images/forum/forward.png' width="18">query topics</img>
			</nobr>
		</div>
		
		<div id="xlvid_center">
			<div id="forum_schema" xlvobject="xlv.obj.pane" xlvprop="{glow:{enable:true},border:{enable:true}}">
				<div style="padding:8px">
				<table style="width:720px">
					<tr><td rowSpan="2"> 
							<img width="48" src="/xlive/images/forum/query.png"></img>
						</td>
						<td align="left" valign="middle"><nobr> Query topic title : </nobr>
						</td>
						<td  align="left" valign="middle">
							<div xlvobject="xlv.obj.viewer" style="white-space:nowrap;font-weight:bold"
								xlvmethod="{
									initial:function(){
										this.$self('initial');
										var queryTopic_main=xlv.util.findParent(this,{id:'queryTopic_main'});
										this.mvc_valueToView(queryTopic_main.$P.caller.query_text);
									}
								}"
							>
							</div>
						</td>
						<td width="100%"></td>
					</tr>
					<tr>	
						<td  align="left" valign="middle"> <nobr> Total topics found :  </nobr>
						</td>
						<td  align="left" valign="middle"> 
			    			<div style="white-space:nowrap;font-weight:bold" xlvobject="xlv.obj.viewer" xlvprop="{dmName:'forum.topic',dmPath:'properties.query-list.return.sql-statement.return.data/@eofRows'}"
			    				xlvmethod="{
			    					mvc_valueToView:function(value){
			    						xlv.util.setElementValue(this,value);
			    					}
			    				}"
			    			>
			    			</div>
						</td>
						<td  align="right">
							<div xlvobject="xlv.obj.viewer" style="white-space:nowrap;font-size:10px;color:gray"
								xlvmethod="{
									initial:function(){
										this.$self('initial');
										var date = new Date();
										this.mvc_valueToView(date.formatDate('yyyy/MM/dd HH:mm:ss'));
									}
								}"
							>
							</div>
						</td>
					</tr>
				</table>
				</div>
			</div>
			<div style="position:relative;">
				<div style="position:relative;float:right" id="page_control" xlvobject="xlv.obj.viewer" xlvprop="{dmName:'forum.topic',dmPath:'properties.query-list.return.sql-statement.return.data/@eofRows'}"
					xlvmethod="{
						flipPages:function(next){
							var pages=xlv.util.children(this,{id:'page'},null);
							var first=parseInt(pages[0].getTitle());
							if(next){
								first +=10;
								if(first+10 &gt; this.$V.total) first=this.$V.total-9;
							}else {
								first -=10;
								if(first &lt; 1) first=1;
							}
							var last=first+pages.length-1;
							for(var i=0; i &lt; pages.length;++i){
								pages[i].setTitle(first+i);
								if((first+i)==this.$V.current)Element.addClassName(pages[i],'current_page');
								else Element.removeClassName(pages[i],'current_page');
							}
							this.getObjectById('next_flip').style.display=(this.$V.total!=last)?'':'none';
							this.getObjectById('prev_flip').style.display=(first &gt; 1) ? '' :'none';
						},
						nextPage:function(offset){
							var page=parseInt(this.$V.current)+offset;
							if(page &lt; 1 || page &gt; this.$V.total) return;
							this.showPage(page);
						},
						showPage:function(page){
							if(Element.hasClassName(this,'wait')) return;
							Element.addClassName(this,'wait');
							var dm=this.getDataModel('forum.topic');
							dm.setValue((page-1)*this.$V.row_fetch+1,'properties.query-list.row-from');
							dm.webMethod('query-list');
						},
						refreshPage:function(){
							this.showPage(this.$V.current);
						},
						mvc_valueToView:function(value){
							var dm=this.getDataModel('forum.topic');
							var row_from=dm.getValue('properties.query-list.row-from');
							var row_fetch=dm.getValue('properties.query-list.row-fetch');
							this.$V.current=parseInt(row_from/row_fetch)+((row_from%row_fetch != 0)?1:0);
							this.$V.row_fetch=row_fetch;
							this.$V.total=Math.floor(value/row_fetch)+((value%row_fetch !=0)?1:0);
							this.$V.total=(!this.$V.total)? 1:this.$V.total;
							xlv.util.setElementValue(this.getObjectById('current_page'),this.$V.current);
							xlv.util.setElementValue(this.getObjectById('total_pages'),this.$V.total);
							var page_container=this.getObjectById('page_container');
							var pages=xlv.util.children(page_container,{id:'page'},null);
							var first=(pages.length!=0)?parseInt(pages[0].getTitle()):1;
							if(this.$V.current &gt; first+9) first=this.$V.current-9;
							else if(this.$V.current &lt; first) first=this.$V.current;
							var method={process:function(){
									var p=xlv.util.findParent(this,{id:'page_control'});
									p.showPage(this.getTitle());
								}};
							var last=first;	
							for(var i=0;i &lt; this.$V.total;++i){
								var page=(pages[i])? pages[i]:xlv.sys.newInstance(page_container,'process',null,method,null);
								page.setTitle(first+i);
								page.setAttribute('id','page');
								if(first+i==this.$V.current) Element.addClassName(page,'current_page');
								else Element.removeClassName(page,'current_page');
								last=first+i;
								if(i==9)break;
							}
							for(var i=this.$V.total; i &lt; 10; ++i){
								if(pages[i] &amp;&amp; pages[i].parentNode) pages[i].parentNode.removeChild(pages[i]);
							}
							this.getObjectById('next_flip').style.display=(this.$V.total!=last)?'':'none';
							this.getObjectById('prev_flip').style.display=(first &gt; 1) ? '' :'none';
							Element.removeClassName(this,'wait');
						}
					}"
					>
					<div style="float:right" id="prev_page" xlvobject="xlv.obj.process" xlvprop="{srcImg:'/xlive/images/forum/rightArrow.png'}"
						 xlvmethod="{
						 	process:function(){xlv.util.findParent(this,{id:'page_control'}).nextPage(1);}
						 }"
						>
					</div>
					<div style="float:right;display:none" id="next_flip" xlvobject="xlv.obj.process" xlvprop="{title:'...'}"
						 xlvmethod="{
						 	process:function(){xlv.util.findParent(this,{id:'page_control'}).flipPages(true);}
						 }"
						>
					</div>
					<div style="float:right;position:relative;" id="page_container"></div>
					<div style="float:right;display:none" id="prev_flip" xlvobject="xlv.obj.process" xlvprop="{title:'...'}"
						 xlvmethod="{
						 	process:function(){xlv.util.findParent(this,{id:'page_control'}).flipPages(false);}
						 }"
						>
					</div>
					<div style="float:right" id="prev_page" xlvobject="xlv.obj.process" xlvprop="{srcImg:'/xlive/images/forum/leftArrow.png'}"
						 xlvmethod="{
						 	process:function(){xlv.util.findParent(this,{id:'page_control'}).nextPage(-1);}
						 }"
						>
					</div>
					<span style="float:right;margin-top:4px">Current page : <span id="current_page"></span> / <span id="total_pages"></span> Total pages </span>
				</div>
			</div>
			<div id="forum_topic" xlvobject="xlv.obj.table" style="background:white;border-collapse:collapse;clear:both;"
				 xlvprop="{ selectable:false,dmName:'forum.topic',
				 			columns:[{title:'TOPICS',dmPath:'TOPIC_ICON'},
				 			         {title:'',dmPath:'TOPIC_TITLE'},
				 			         {title:'REPLIES',dmPath:'POST_COUNT'},
				 			         {title:'VIEWS',dmPath:'TOPIC_VIEWS'},
				 			         {title:'LASTPOST',dmPath:'POST_LASTTIME'}
				 					 ]}"
				 xlvmethod="{
				 		styleForHeader:function(cell_no,cell){
				 			var style={height:'32px',width:'40px',background:'url(/xlive/images/blueTexture.gif) left top repeat'};
				 			if(cell_no==2 &amp;&amp; (Prototype.Browser.IE ||Prototype.Browser.Gecko)) style.width='100%';
				 			if(cell_no==5) style.width='100px';
				 			style.border='1px solid gray';
				 			Element.setStyle(cell,style);
				 		},
				 		styleForCell:function(row_no,cell_no,cell){
							cell.setAttribute('unselectable','on');
							var style={margin:'4px'};
							if(cell_no==1||cell_no==3||cell_no==4) style.textAlign='center';
							Element.setStyle(cell,style);
							cell.style.padding='8px 4px';
						},
				 		mvc_valueFromModel:function(dm,row_no,cell_no){
							return dm.getNode(this.$P.columns[cell_no-1].dmPath,row_no);
						}
				 }"
			    >
			    <table>
			    	<tbody>
			    		<tr>
			    			<td><div id="topic_icon" xlvobject="xlv.obj.img" xlvprop="{width:32,height:32}"></div></td>
			    			<td><div id="topic_title_viewer" xlvobject="xlv.obj.viewer"
			    					xlvmethod="{
			    							mvc_valueToView:function(node,row_no,cell_no){
			    								this.$V.topicNode=node.parentNode;
			    								var user_name=this.getObjectById('user_name');
			    								user_name.setTitle(xlv.util.getXmlNodeValue('USER_NAME',node.parentNode)+' : ');
			    								user_name.$V.user_key=xlv.util.getXmlNodeValue('USER_KEY',node.parentNode);
			    								var value=xlv.util.getXmlNodeValue('TOPIC_TIME',node.parentNode);
			    								value= new Date().parseDate(value).formatDate('yyyy/MM/dd HH:mm:ss');
			    								xlv.util.setElementValue(this.getObjectById('topic_time'),value);
			    								var title=this.getObjectById('topic_title');
			    								var title_text=xlv.util.getElementValue(node);
			    								var query_text=xlv.util.findParent(this,{id:'queryTopic_main'}).$P.caller.query_text;
			    								title_text=title_text.replace(new RegExp(query_text,'img'),'&lt;span style=color:blue &gt;'+query_text+'&lt;/span&gt;');
			    								title.setTitle(title_text);
			    								title.$V.topic_key=xlv.util.getXmlNodeValue('TOPIC_KEY',node.parentNode);
			    								title.$V.schema_key=xlv.util.getXmlNodeValue('SCHEMA_KEY',node.parentNode);
			    								var schema_title=this.getObjectById('schema_title');
			    								schema_title.setTitle(xlv.util.getXmlNodeValue('SCHEMA_TITLE',node.parentNode));
			    								schema_title.$V.schema_key=xlv.util.getXmlNodeValue('SCHEMA_KEY',node.parentNode);
			    						}}"
			    					>
			    					<div id="schema_title" xlvobject="xlv.obj.process" style="padding:4px"
			    						xlvmethod="{
			    							process:function(options){
			    							this.getBorderLayoutById('forum_main').setCenterPane('/xlive/forum/schema.html',{caller:{schema_key:this.$V.schema_key}},null,'bottom');
			    						 }}"
			    					>
			    					</div>
			    					<br/>
			    					<div id="topic_title" xlvobject="xlv.obj.process" style="font-weight:bold;padding:8px"
			    						xlvmethod="{
			    							setTitle:function(title){
												this.$V.title.innerHTML=title;
											},
			    							process:function(options){
			    							this.getBorderLayoutById('forum_main').setCenterPane('/xlive/forum/topic.html',{caller:{topic_key:this.$V.topic_key,schema_key:this.$V.schema_key}},null,'bottom');
			    						 }}"
			    					>
			    					</div>
			    					<div>
			    						<span id="user_name" style="white-space:nowrap;font-size:10px;color:gray;text-align:right" xlvobject="xlv.obj.process"
			    								xlvmethod="{
			    									process:function(options){
				    									var prop={caller:{user_key:this.$V.user_key}};
				    									this.getDesktop().showPane('/xlive/forum/user.html',prop,null,{invoker:this,align:'left'});
			    									}
			    								}"
			    						>
			    						</span>
			    						<span id="topic_time" style="white-space:nowrap;font-size:10px;color:gray;text-align:right" ></span>
			    				
			    					</div>
			    				</div>
			    			</td>
			    			<td><div id="post_count" xlvobject="xlv.obj.viewer" style="color:gray"></div></td>
			    			<td><div id="topic_views" xlvobject="xlv.obj.viewer" style="color:gray"></div></td>
			    			<td><div id="post_lasttime" style="white-space:nowrap;color:gray;font-size:9px" xlvobject="xlv.obj.viewer" 
			    					xlvmethod="{
			    						mvc_valueToView:function(value){
			    							value=xlv.util.getElementValue(value);
			    							if(value){
			    								value= new Date().parseDate(value).formatDate('yyyy/MM/dd HH:mm:ss');
			    								xlv.util.setElementValue(this,value);
			    							}else xlv.util.setElementValue(this,'');
			    						}
			    					}"
			    					>
			    				</div>
			    			</td>
			    		</tr>
			    	</tbody>
			    </table>	
			</div>
		</div>
		

		<div id="xlvid_south">
			<!-- <div xlvobject="xlv.obj.tree" xlvprop="{dmName:'forum.topic'}"></div>-->
		</div>
	</div>
</body>
</html>
